package org.springframework.howelly.services;

import java.text.ParseException;
import java.util.List;

import org.springframework.howelly.helpers.SearchCriteria;
import org.springframework.howelly.model.Gasto;
import org.springframework.howelly.model.Obra;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * A service interface for retrieving hotels and bookings from a backing repository. Also supports the ability to cancel
 * a booking.
 */
@Service
@Transactional(readOnly = true)
public interface ObraService {

    /**
     * Find obras available for booking by some criteria.
     * @param criteria the search criteria
     * @return a list of obras meeting the criteria
     */
    public List<Obra> findObras(SearchCriteria criteria);

    /**
     * Find obras by their identifier.
     * @param id the obra id
     * @return the obra
     */
    public Obra findObrasById(Long id);

    /**
     * Create a new, transient obra booking instance for the given user.
     * @param obraId the obraId
     * @param userName the user name
     * @return the new transient booking instance
     * @throws ParseException
     */
    public Gasto createBooking(Long obraId, String userName) throws ParseException;

    public Obra createObra(Obra obra);

    public Obra updateObra(Obra obra);

    public boolean deleteObra(Obra obra);
}
